package com.yjd.bi.growing.dao.impl;

import org.springframework.stereotype.Component;
import com.yjd.comm.base.dao.impl.BaseDaoImpl;
import com.yjd.bi.growing.model.UserGrowingStatisticsModel;
import com.yjd.bi.growing.dao.IUserGrowingStatisticsDao;

import java.util.List;
import java.util.Map;

/**
 * <b>description</b>：用户成长支持统计数据访问层 <br>
 * <b>time</b>：2018-08-13 14:21:23 <br>
 * <b>author</b>： weili valie.lin@foxmail.com
 */
@Component("userGrowingStatisticsDao")
public class UserGrowingStatisticsDaoImpl extends BaseDaoImpl implements IUserGrowingStatisticsDao {

	private static final String SQLMAPNAMESPACE = UserGrowingStatisticsModel.class.getName();
	private static final String PKNAME = "user_id";

	@Override
	public String getPrimaryKeyName() {
		return PKNAME;
	}

	@Override
	public String getSqlmapNamespace() {
		return SQLMAPNAMESPACE;
	}

	@Override
	public List<Long> queryUseridList(Map paramMap, int page, int rows) throws Exception {
		if(page < 1){
			page = 1;
		}
		if(rows < 1){
			rows = 20;
		}

		paramMap.put("rowstartindex", (page-1)*rows);
		paramMap.put("rowendindex", rows);
		paramMap.put("dbtype", dbtype);

		return this.getSqlMap(false).queryForList(this.getStatement("queryUseridList"), paramMap);
	}
}
